package com.jzt.ic;

import com.yvan.dsf.DsfConfigurableInitializer;
import com.yvan.dsf.EnableDsfConfiguration;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaAutoConfiguration;

/**
 * Created by luoyifan on 2017/11/21.
 */
@SpringBootApplication(exclude = {
        HibernateJpaAutoConfiguration.class
})
@EnableDsfConfiguration
public class DemoIcMain {

    public static void main(String[] args) {
        //String beanName = ManagementFactory.getRuntimeMXBean().getName();
        //org.slf4j.MDC.put("process_id", beanName);
        //SpringApplication.run(DemoIcMain.class, args);
        SpringApplication application = new SpringApplication(DemoIcMain.class);
        application.addInitializers(new DsfConfigurableInitializer(args));
        application.run(args);
    }

    /*
    @Bean
    public ServletListenerRegistrationBean<com.alibaba.dubbo.remoting.http.servlet.BootstrapListener> testListenerRegistration() {

        com.alibaba.dubbo.remoting.http.servlet.BootstrapListener bootstrapListener
                = new com.alibaba.dubbo.remoting.http.servlet.BootstrapListener();

        ServletListenerRegistrationBean<com.alibaba.dubbo.remoting.http.servlet.BootstrapListener> registration =
                new ServletListenerRegistrationBean<>(bootstrapListener);
        return registration;
    }

    @Bean
    public ServletRegistrationBean dispatcherRegistration(DispatcherServlet dispatcherServlet) {
        ServletRegistrationBean registration = new ServletRegistrationBean(dispatcherServlet);
        registration.addUrlMappings("/*");
        return registration;
    }

    @Bean
    public ServletRegistrationBean testServletRegistration() {
        new com.alibaba.dubbo.remoting.http.servlet.DispatcherServlet();
        ServletRegistrationBean registration = new ServletRegistrationBean(
                com.alibaba.dubbo.remoting.http.servlet.DispatcherServlet.getInstance()
        );
        registration.addUrlMappings("/rest/*");
        registration.setName("rest");
        return registration;
    }
    */
}
